<?php
/*
	
*/
defined('BY_JYA') or exit('Access Denied');
global $_RQ,$_AR;
$_RQ['op']=$_RQ['op']?$_RQ['op']:'main';
if($_RQ['op']=='main'){
	$page=core_setting('site');
	$return['site']=$page;
	$return['pcd']=array(
		'province' =>trim($_RQ['province']),
		'city' =>trim($_RQ['city']),
		'district' =>trim($_RQ['district']),
	);
	set_html('title','门店列表');
	$return['sharedata']=array(
		'title'=>$basic['share_title'].'门店列表',
		'desc'=>$basic['share_desc']?$basic['share_desc']:'线下到店面诊方便快捷',
		'link'=>custom_url('core/home.store_list/',true),
		'imgUrl'=>ATTACHMENT_URL.$basic['share_image'],
	);
	$return['params']=array(
		'order'=>$_RQ['order']
	);
	if($_RQ['keyword']){
		$return['params']['keyword']=$_RQ['keyword'];
	}
	exi($return);
}
if($_RQ['op']=='getlist'){
	$post=get_postdata();
	$params=array('uniacid'=>1,'status'=>1);
	if($_RQ['keyword']){
		$params['title like']='%'.trim($_RQ['keyword']).'%';
	}
	//排序门店
	$pindex = max(1, intval($_RQ['page']));
	$psize = 10;
	$total='';
	$return['status']=0;
	$parameter=array(
		'params'=>$params,
		'limit'=>array($pindex,$psize),
		'fields'=>$fields,
		'orderby'=>$orderby,
	);
	$list=pdo_getslice('jy_weishop_store',$params,array($pindex,$psize),$total,$fields,'','paixu desc');
	$sum=0;
	if($list){
		$sum=count($list);
		foreach($list as &$item){
			$item['lat_lng']=json_decode($item['lat_lng'],true);
		}
	}
	$return['list']=$list;
	$return['sum']=$sum;
	set_html('title','门店列表');
	$page=core_setting('site');
	$return['sharedata']=array(
		'title'=>'门店列表'.$page['share_title'],
		'desc'=>'门店列表'.$page['share_desc'],
		'link'=>custom_url('core/home.store_list/',true),
		'imgUrl'=>ATTACHMENT_URL.$page['share_image'],
	);
	exi($return);
}
	
